import { Pipe, PipeTransform } from '@angular/core';

/**
 * 替换银行卡号码中间四位变成*
 */
@Pipe({
  name: 'bank',
})
export class BankPipe implements PipeTransform {
  /**
   * @Input: {{'6235425252131257' | bank}}
   * @Output: **** **** **** 1257
   */
  transform(value: string) {
    const reg = /^(?:\d+)(.{4})$/;
    return value.replace(reg, "**** **** **** $1");
  }
}
